module.exports = io=>{
    const chart = io.of('/chart')

    chart.on('connection',socket=>{
        console.log('chart connection',socket.id);
        // console.log('sockeData:',socket.data);
        // console.log('sockeHandshake:',socket.handshake);
        socket.on('t1',data=>{
            socket.emit('t1',data)
        })
        socket.on('join_room',(data,ack)=>{
            socket.join(data)
            ack([...socket.rooms])
            console.log('join_room',data);
            console.log('rooms',socket.rooms);
        })
        socket.on('create_room',(data,ack)=>{
            socket.join(data)
            ack()
        })
        socket.on('leave-room',data=>{
            socket.leave(data)
            console.log('leave-room',data);
            console.log(socket.rooms);
        })
        socket.on('disconnect',(reason)=>{
            console.log('disconnect',reason);
        })
    })
    // chart.adapter.on('create-room',(room)=>{
    //     console.log('create-room',room);
    //     const allrooms = chart.adapter.rooms
    //     console.log('all rooms',allrooms);
    // })
    // chart.adapter.on('delete-room',(room)=>{
    //     console.log('delete-room',room);
    // })

}